/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */
import request from '@/utils/request';

/**
 * 每日统计修改请求路径
 *  */
const changeUrl = (url, source) => {
  if (source == 'yz_h5') {
    return url.replace('InnStatictis', 'InnActiveStatictis');
  }

  return url;
};

// 获取同城订单
export async function getOrderList(params) {
  return request('/Api/Order/index', {
    method: 'POST',
    body: params,
  });
}
// 订单明细
export async function getOrderDetailsList(params) {
  return request('/Api/OrderData/getOrderList', {
    method: 'POST',
    body: params,
  });
}
// 下载同城订单
export async function downloadOrderList(params) {
  return request('/Api/Order/index', {
    method: 'POST',
    body: params,
  });
}

// 驿站，站点
export async function getStationList(params) {
  return request('/Api/Site/list', {
    method: 'POST',
    body: params,
  });
}
// 中邮，站点
export async function getZyStationList(params) {
  return request('/Api/Site/listForChinaPost', {
    method: 'POST',
    body: params,
  });
}
// 第三方，站点列表
export async function getOthersStationList(params) {
  return request('/Api/Site/ListForPartner', {
    method: 'POST',
    body: params,
  });
}

// 站点删除
export async function deleteStation(params) {
  return request('/Api/Site/delSite', {
    method: 'POST',
    body: params,
  });
}

// 第三方站点删除
export async function deleteStationForPartner(params) {
  return request('/Api/Site/delSiteForPartner', {
    method: 'POST',
    body: params,
  });
}

// 站点保存
export async function saveStation(params) {
  return request('/Api/Site/addSite', {
    method: 'POST',
    body: params,
  });
}

// 第三方，站点保存
export async function saveStationForPartner(params) {
  return request('/Api/Site/editSiteForPartner', {
    method: 'POST',
    body: params,
  });
}

// 业务员
export async function getOperatorList(params) {
  return request('/Api/Courier/list', {
    method: 'POST',
    body: params,
    nonceKey: 'site_id',
  });
}

// 驿站，添加业务员
export async function saveOperator(params) {
  return request('/Api/Courier/addCourier', {
    method: 'POST',
    body: params,
  });
}

// 中邮，添加业务员
export async function zySaveOperator(params) {
  return request('/Api/Courier/addCourierForChinaPost', {
    method: 'POST',
    body: params,
  });
}

// 编辑业务员
export async function editorOperator(params) {
  return request('/Api/Courier/editCourier', {
    method: 'POST',
    body: params,
  });
}

// 删除业务员
export async function deleteOperator(params) {
  return request('/Api/deleteOperator', {
    method: 'POST',
    body: params,
  });
}

// 站点业务员列表
export async function siteOperator(params) {
  return request('/Api/Courier/siteList', {
    method: 'POST',
    body: params,
    nonceKey: 'site_code',
  });
}

// 下属驿站
export async function subList(params) {
  return request('/Api/YZ/CourierStation/subList', {
    method: 'POST',
    body: params,
    nonceKey: 'code',
  });
}

// 获取驿站列表
export async function getAreaList(params) {
  return request('/Api/YZ/CourierStation/getInnsList', {
    method: 'POST',
    body: params,
  });
}

// 申请加盟驿站列表
export async function getApplyList(params) {
  return request('/Api/YZ/CourierStation/applyList', {
    method: 'POST',
    body: params,
  });
}

// 获取品牌列表
export async function getBrandsList(params) {
  return request('/Api/YZ/CourierStation/getBrandsList', {
    method: 'POST',
    body: params,
  });
}

// 数据统计
export async function getPostList(params) {
  return request('/Api/YZ/CourierStation/webCount', {
    method: 'POST',
    body: params,
  });
}

// 添加驿站
export async function AddAreaPost(params) {
  return request('/Api/YZ/CourierStation/addStation', {
    method: 'POST',
    body: params,
  });
}

// 关闭驿站
export async function CloseAreaPost(params) {
  return request('/Api/YZ/CourierStation/closeStation', {
    method: 'POST',
    body: params,
  });
}

// 统计折线图
export async function getLeague(params) {
  return request('/Api/YZ/CourierStation/league', {
    method: 'POST',
    body: params,
  });
}

// 饼图
export async function getPies(params) {
  return request('/Api/YZ/CourierStation/pies', {
    method: 'POST',
    body: params,
  });
}

// 管辖区域
export async function getbrandList(params) {
  return request('/Api/BusinessCooperation/brandList', {
    method: 'POST',
    body: params,
  });
}

// 商城状态审核
export async function getStatus(params) {
  return request('/Api/BusinessCooperation/getStatus', {
    method: 'POST',
    body: params,
  });
}

// 申请开通
export async function getOpen(params) {
  return request('/Api/BusinessCooperation/save', {
    method: 'POST',
    body: params,
  });
}

// 从下属驿站中删除
export async function deleteArea(params) {
  return request('/Api/YZ/CourierStation/delSubDak', {
    method: 'POST',
    body: params,
  });
}

// 获取验证码
export async function SendCode(params) {
  return request('/Api/Verify/sendCode', {
    method: 'POST',
    body: params,
  });
}

// 申请关闭
export async function applyCloseDak(params) {
  return request('/Api/YZ/CourierStation/applyCloseDak', {
    method: 'POST',
    body: params,
  });
}

// 免密登录
export async function noPwdLogin(params) {
  return request('/Api/YZ/CourierStation/noPwdLogin', {
    method: 'POST',
    body: params,
  });
}

// 免密登录
export async function getYzStatus(params) {
  return request('/Api/YZ/CourierStation/getBrandsAuth', {
    method: 'POST',
    body: params,
  });
}

// H5数据统计，总览数据
export async function getOverviewData(params) {
  return request('/api/dataOverview', {
    method: 'POST',
    body: params,
  });
}

// 出库折线统计
export async function storageSummary(params) {
  const { source, ...rest } = params || {};
  return request(changeUrl('/Api/InnStatictis/storageSummary', source), {
    method: 'POST',
    body: rest,
  });
}

// 出库饼图统计
export async function storagePic(params) {
  const { source, ...rest } = params || {};
  return request(changeUrl('/Api/InnStatictis/storagePic', source), {
    method: 'POST',
    body: rest,
  });
}

// 获取柱状图
export async function getHistogram(params) {
  const { source, ...rest } = params || {};
  return request(changeUrl('/Api/InnStatictis/rank', source), {
    method: 'POST',
    body: rest,
    nonceKey: 'code',
  });
}

// 短信折线统计
export async function smsSummary(params) {
  const { source, ...rest } = params || {};
  return request(changeUrl('/Api/InnStatictis/smsSummary', source), {
    method: 'POST',
    body: rest,
  });
}

// 订单折线统计
export async function orderSummary(params) {
  const { source, ...rest } = params || {};
  return request(changeUrl('/Api/InnStatictis/orderSummary', source), {
    method: 'POST',
    body: rest,
  });
}

// 订单饼图统计
export async function orderPic(params) {
  return request('/Api/InnStatictis/orderPic', {
    method: 'POST',
    body: params,
  });
}

// 粉丝折线统计
export async function fansSummary(params) {
  return request('/Api/YZ/WxFansStat/dakFansStatByDay', {
    method: 'POST',
    body: params,
  });
}

// 出库汇总列表
export async function storageSum(params) {
  return request('/Api/InnStatictis/storageSum', {
    method: 'POST',
    body: params,
  });
}

// 出库列表
export async function storageList(params) {
  return request('/Api/InnStatictis/storageList', {
    method: 'POST',
    body: params,
    nonceKey: 'cm_id,area_id',
  });
}

// 短信汇总列表
export async function smsSum(params) {
  return request('/Api/InnStatictis/smsSum', {
    method: 'POST',
    body: params,
  });
}

// 短信列表
export async function smsList(params) {
  return request('/Api/InnStatictis/smsList', {
    method: 'POST',
    body: params,
  });
}

// 订单汇总列表
export async function orderSum(params) {
  return request('/Api/InnStatictis/orderSum', {
    method: 'POST',
    body: params,
  });
}

// 订单列表
export async function orderList(params) {
  return request('/Api/InnStatictis/orderList', {
    method: 'POST',
    body: params,
  });
}

// 粉丝汇总列表
export async function dakFansSummaryStat(params) {
  return request('/Api/YZ/WxFansStat/dakFansSummaryStat', {
    method: 'POST',
    body: params,
    nonceKey: 'cm_id,area_id',
  });
}

// 30日入库率
export async function inStorageRate(params) {
  const { source, ...rest } = params || {};
  return request(changeUrl('/Api/InnStatictis/inStorageRate', source), {
    method: 'POST',
    body: rest,
  });
}
// 3日出库率
export async function outStorageRate(params) {
  return request('/Api/InnStatictis/outStorageRate', {
    method: 'POST',
    body: params,
  });
}
// 3日出库率列表
export async function outStorageRateList(params) {
  return request('/Api/InnStatictis/outStorageRateList', {
    method: 'POST',
    body: params,
  });
}
// 每周投诉率
export async function eachWeekComplaintRate(params) {
  const { source, ...rest } = params || {};
  return request(changeUrl('/Api/InnStatictis/complainRate', source), {
    method: 'POST',
    body: rest,
  });
}
// 订单列表
export async function dakFansEverydayStat(params) {
  return request('/Api/YZ/WxFansStat/dakFansEverydayStat', {
    method: 'POST',
    body: params,
  });
}

// 获取数据统计昨日数据总览
export async function yesterdaData(params) {
  const { source, ...rest } = params || {};
  return request(changeUrl('/Api/InnStatictis/stat', source), {
    method: 'POST',
    body: rest,
  });
}

// 获取快宝驿站下属区域
export async function kbGetArearList(params) {
  return request('/Api/YZ/League/stepGetArea', {
    method: 'POST',
    body: params,
    allowConcurrent: true, // 允许并发请求
  });
}

// 设置管理，报表数据推送设置，获取列表
export async function getPostSetList(params) {
  return request('/Api/YZ/League/listUsers', {
    method: 'POST',
    body: params,
  });
}

// 设置管理，报表数据推送设置，添加
export async function addPostSet(params) {
  return request('/Api/YZ/League/addNoticeUser', {
    method: 'POST',
    body: params,
  });
}

// 设置管理，报表数据推送设置，删除
export async function delPostSet(params) {
  return request('/Api/YZ/League/deleteUser', {
    method: 'POST',
    body: params,
  });
}

// 设置管理，通知管理，获取列表
export async function getNoticeList(params) {
  return request('/Api/YZ/League/notice', {
    method: 'POST',
    body: params,
  });
}

// 设置管理，通知管理，删除列表
export async function delNoticeList(params) {
  return request('/Api/YZ/League/deleteNotice', {
    method: 'POST',
    body: params,
  });
}

// 设置管理，通知管理，新建通知
export async function saveNotice(params) {
  return request('/Api/YZ/League/addNotice', {
    method: 'POST',
    body: params,
  });
}

// 设置管理，通知管理，保存通知（提交审核）
export async function editNotice(params) {
  return request('/Api/YZ/League/updateNotice', {
    method: 'POST',
    body: params,
  });
}

// 设置管理，通知管理，获取上传图片URL
export async function getImgURL(params) {
  return request('/Api/YZ/League/uploadImage', {
    method: 'POST',
    body: params,
  });
}

// 中邮，区域排名，获取列表详情
export async function rankDetailList(params) {
  return request('/Api/InnStatictis/rankDetail', {
    method: 'POST',
    body: params,
  });
}
// 获取订单工作台数据

export async function getOrderWorkTopInfo(params) {
  return request('/Api/OrderData/getInfo', {
    method: 'POST',
    body: params,
  });
}
// 获取订单工作台展示的图表数据
export async function getWorkEchartsData(params) {
  return request('/Api/OrderData/getOrderInfo', { method: 'POST', body: params });
}
// 关闭订单
export async function closeOrder(params) {
  return request('/Api/OrderData/closeOrder', { method: 'POST', body: params });
}

// 添加订单导出任务
export async function addExportOrderTask(params) {
  return request('/Api/OrderData/exportData', { method: 'POST', body: params });
}
// 获取导出列表
export async function getOrderExportList(params) {
  return request('/Api/OrderData/getExportList', { method: 'POST', body: params });
}
// 订单明细，分配订单
export async function dispatchOrder(params) {
  return request('/Api/OrderData/allocationOrder', { method: 'POST', body: params });
}
// 订单明细，获取品牌
export async function getBrands(params) {
  return request('/Api/OrderData/brands', { method: 'POST', body: params });
}
// 获取当前用户是否有设置百世巴枪密码的权限
export async function getHtAuth(params) {
  return request('/Api/HtWhitePhone/getHtWhitePhone', { method: 'POST', body: params });
}
// 驿站大屏登录
export async function bigScreenLogin(params) {
  return request('/Api/ShareLink/validate', { method: 'POST', body: params });
}
// 驿站大屏，获取已登录的用户列表
export async function getScreenLoginUser(params) {
  return request('/Api/ShareLink/getShareInfo', { method: 'POST', body: params });
}
// 驿站大屏，生成大屏链接及密码
export async function generatePsw(params) {
  return request('/Api/ShareLink/generate', { method: 'POST', body: params });
}
// 驿站大屏，获取登录用户信息
export async function getScreenLoginInfo(params) {
  return request('/Api/ShareLink/getLeagueInfo', { method: 'POST', body: params });
}
